<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>增加项目立项</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<%@include file="../resource.jsp" %>
<style>
	.mini-grid-summaryCell{text-align:right;color: red;font-weight: bold;}
	.myRowCls { font-size:14px;color:red  }
	.myRowClss { font-size:14px;color:black  }
	.myRowClsss { background-color : #D0D0D0 }
	.errorRow { font-size:14px;color:blue  }
</style>

<script language="JavaScript" type="text/javascript">
function wfSaveDoc() {
	/*不做任何操作保存文档*/
	if(confirm("确定保存文档吗？")){
		try{gForm.WFFlowLogXML.value=dojox.xml.parser.innerXML(gWFLogXML)}catch(e){};
		fnResumeDisabled(); //恢复部分域的失效状态，以保证保存时值不会变为空。
		//gForm["$$QuerySaveAgent"].value="(wqsWFSave)";
		//保存时状态默认值为0;
		$("[name='wfStatus']").val("0");
		gForm.submit();
	}
}
function wfAgreeDoc(){
	//提交前处理数据
	if(gForm.WFStatus.value==0){SubmitBefore()}
	if(confirm("您确定同意吗？")){
		if(arguments.length==1){gWQSagent=arguments[0]}
		gForm.WFTacheName.value="同意";
		wfSubDocStart();
	}
}

function wfConfirmDoc(){
	//提交前处理数据
	if(gForm.WFStatus.value==0){SubmitBefore()}
	if(confirm("您确定确认吗？")){
		if(arguments.length==1){gWQSagent=arguments[0]}
		gForm.WFTacheName.value="确认";
		wfSubDocStart();
	}
}

function wfCompleatDoc(){
	//提交前处理数据
	if(gForm.WFStatus.value==0){SubmitBefore()}
	if(confirm("您确定完成吗？")){
		if(arguments.length==1){gWQSagent=arguments[0]}
		gForm.WFTacheName.value="完成";
		wfSubDocStart();
	}
}
function wfRejectDoc(){
	if(confirm("您确定拒绝吗？")){
		if(arguments.length==1){gWQSagent=arguments[0]}
		gForm.WFTacheName.value="拒绝";
		wfSubDocStart();
	}
}
function goBak(){
	if(dojo.byId("WFIdea")){
		if(dojo.trim(dojo.byId("WFIdea").value)==""){
			dojo.byId("WFIdea").style.borderColor="red";
			dijit.byId("tabAttachContent").selectChild("tabWFIdea");
			if(!dijit.byId("expp")._showing){
				dijit.byId("expp").toggle();
			}
			alert("请您填写拒绝意见！");
			return;
		}
	}
	var idea=dojo.trim(dojo.byId("WFIdea").value);
	var link="/"+gCommonDB+"/fmWFRandomBack?OpenForm&DocID="+gCurDocID+"&TDB="+gCurDBName+"&idea="+encodeURI(idea)+"&idearid="+gIdeaID[0];
	dg.set("content","<iframe style='width:580px;height:400px;border:0px;' src='"+link+"' frameborder='0'></iframe>");
	dg.show();
}
</script>
<script language="JavaScript" type="text/javascript">
document._domino_target = "_self";
function _doClick(v, o, t, h) {
  var form = document._fmWFMainFile;
  if (form.onsubmit) {
     var retVal = form.onsubmit();
     if (typeof retVal == "boolean" && retVal == false)
       return false;
  }
  var target = document._domino_target;
  if (o.href != null) {
    if (o.target != null)
       target = o.target;
  } else {
    if (t != null)
      target = t;
  }
  form.target = target;
  form.__Click.value = v;
  if (h != null)
    form.action += h;
  form.submit();
  return false;
}
</script>

<script language="JavaScript" type="text/javascript">
var addCell='{width: 100,headerAlign:"center",dataType:"currency",vtype:"float",editor:{type: "spinner"}}';
var year=["一","二","三","四","五","六","七","八","九","十"];
function AddCell(e){
	var cols=mini.get("BcellGoal").getColumns();
	for(t=cols.length-2;t>=2;t--){
		mini.get("BcellGoal").removeColumn(cols[t]);
	}
	if(e.value=="")return;
	for(i=0;i<parseInt(e.value);i++){
		var bCell=mini.decode(addCell);
		bCell.field="D"+i;
		bCell.header="第"+year[i]+"年";
		cols.insert(cols.length-1,bCell);
	}
	mini.get("BcellGoal").setColumns(cols);
}

function ToSave(){ 
	if($("[name=Form]").val()=="fmTemplate"){
		$("[name=Form]").val("fmWFMainFile");
	}
	document.forms[0].submit();
}


//提交
function wfSubmitDoc(){
	if(arguments.length==1){
		gWQSagent=arguments[0]
	}
	//GetCurNo(false);
	wfSubDocStart();
}

function afterLoad(){
	/*if(DiyJs.isOpen=="2"){
	}else{
		$("[name=ExcuType]").val($("[name=ExcuName]").val());
	}*/
	//判断是否为新文档
	if(gIsNewDoc!=0){
		//获取单据编号
	//	GetCurNo(true);
		GetCurNo();
	}else{
	}
}

//科目表列点击事件
function BcellBeginCell(e){
	if(e.record.children && e.record.children.length>0){
		e.cancel=true;
	}
}
//科目表编辑事件
var zjYear=0;
function BcellDrawCell(e){
	zjYear=mini.get("BcellGoal").getColumns().length-3;
	if(zjYear!=0){
		var iPrice=0;
		for(t=0;t<zjYear;t++){
			if(e.record["D"+t] && e.record["D"+t]!=""){
				iPrice+=parseFloat(e.record["D"+t]);
			}
		}
		e.record.PriceTotal=iPrice;
	}
}

//获取流水号
/*function GetCurNo(async){
	if(gIsNewDoc==0){ return }
	var intM=0;
	//var path="/"+gCurDB+"/vwGetConDKNo?openView&Count=1";
	var path="/"+gCurDB+"/agt_GetNoByView?openAgent";
	$.ajax({
		url:path,
		async:async,
		type:"post",
		data:{vName:"vwGetProjectNo"},
		success: function(data){
			if(data.trim()=="" || data.trim().indexOf("未找到文档")!=-1){
				intM=1;
			}else{
				intM=parseInt(data.trim())+1;
			}
			mini.getbyName("PrjNo").setValue(DiyJs.gCNo+"-"+intM);
			$("[name=ConNo]").val(intM);
		}
	})
}*/


//项目编号
function GetCurNo(){
	//项目编号生成规则，XM-年月日时分秒组成
	var date = new Date();
	var curno = "XM-"+date.getFullYear()+""+date.getMonth()+""+date.getDate()+date.getHours()+""+date.getMinutes()+""+date.gets;
	$("[name=projectNo]").val(curno);
}


//计算预计周期
function sumDay(){
	var sDay=mini.getbyName("expectStartDate").getValue();
	var eDay=mini.getbyName("expectEndDate").getValue();
	
	if(sDay!="" && eDay!=""){
		if(sDay>eDay){
			mini.getbyName("expectEndDate").setValue("");
			mini.getbyName("expectDay").setValue("");
		}else{
			var sunDay=0;
			if(eDay-sDay==0){
				sunDay=1000*60*60*24
			}else{
				sunDay=(eDay-sDay)+(1000*60*60*24)
			}
			mini.getbyName("expectDay").setValue(sunDay/(1000*60*60*24));
		}
	}else{
		mini.getbyName("expectDay").setValue("");
	}
}

//Grid增加
function StageRow(name) {            
	var row = {};
	mini.get(name).addRow(row);
}

//Grid删除
function StageRemove(name) {
	var grid=mini.get(name); 
	var rows=grid.getSelecteds();
	grid.removeRows(rows);
}
//Grid加载
function StageLoad(name){
	mini.get(name).setData(mini.decode($("[name="+name+"]").val()));
}
//Grid保存
function StageSave(name){
	$("[name="+name+"]").val(mini.encode(mini.get(name).getData()));
}

</script>

</head>
<body text="#000000" bgcolor="#FFFFFF"  style='padding:0px;width:100%;height:100%;background:#f3f3f3;'>
<form method="post" name="main_form" action="<%=path%>/promanage/addPromanage.action">
		<div style="display:none">
			<input name = "menuId" value="${param.menuId }"/>
			<input name = "wfInitiator" value="${session.user.userName}"/>
			<input name = "curUser" value="${session.user.userName }"/>
			<input name = "wfTacheName" value="${wfTacheName }"/>
			<input name = "wfCurNodeId" value="${wfCurNodeId }"/>
			<input name = "wfPreNodeId" value="${wfPreNodeId }"/>
			<input name = "wfPreUser" value="${wfPreUser }"/>
			<input name = "wfWaitApproval" value="${wfWaitApproval }"/>
			<input name = "wfFinishApproval" value="${wfFinishApproval }"/>
			<input name = "allUser" value="${session.user.userName }"/>
			<input name = "wfStatus" value="${wfStatus}"/>
			<input name = "wfRouterId" value="${wfRouterId }"/>
			<input name = "wfDocLink" value="${wfDocLink }"/>
			<textarea name = "wfFlowLogXml">${wfFlowLogXml}</textarea>
			<textarea name = "wfProcessXml">${wfProcessXml}</textarea>
			<textarea name = "wfGraphXml">${wfGraphXml}</textarea>
			<input name = "subTime" value="${subTime }"/>
			<input name = "subPerson" value="${subPerson }"/>
			<input name = "tempUserName" value="${tempUserName }"/>
		</div>
<script>

var gForm=document.forms[0],
	 gWFID = "402881e653756d6501537576f3460000",
	 gIsEditDoc = "1",
	 gIsNewDoc = "1",
	 gWFStatus = 0,
	 gArrBtns=[],
	 gServerTime="<%=(new java.util.Date()).toLocaleString()%>",
	 gUserCName = "${session.user.userName }", //[<!--当前登录用户-->]
	 gCloseBtn=[
				{name:"查看流程图",title:"查看流程图",ico:"icon-tip",clickEvent:"goLookWorkFlow()",align:"2",isHidden:"1"},
				{name:"关闭",title:"关闭",ico:"icon-close",clickEvent:"try{top.goCloseTab('',false)}catch(e){clo()}",align:"2",isHidden:"1"}
			];

</script>

<div style="width:1200px;margin:auto;padding-top:40px;">
<div class="col-md-7" style="width:1200px;margin:0px auto;float:none;">
<style>
	
	#tab .td_left{
		width:150px;
	}
	#tab .td_right{
		width:250px;
	}
</style>
<!--此注释不允许删除读取字段用-->
<div class="col-md-7" name="FormMode" id="FormMode" style="width:1200px;margin:20px auto;float:none;">
    <div class="widget-container fluid-height col-md-7-k" style="height:auto;border-radius:4px;">
	<div class="mbox-header" >
		<span class="form-title" style="height:100%;line-height:45px;">
			<i class="o-host-application" style="background-position: -0px -20px;"></i>
			基本信息
		</span>
	</div>
	<div class="mbox-body"  style="height:100%;padding:10px;">
<table style="width:97%;margin-top:5px;" id="tab">
	<tr>
		<td class="td_left" >制单人：</td>
		<td class="td_right" >
			<input name="createBy" value="${session.user.userName}" class="mini-textbox"  allowInput="false" required="true"  style="width:99%;" title="制单人"></td>
		<td class="td_left" >制单时间：</td>
		<td class="td_right" >
			<input name="createDate" value="<%=(new java.util.Date()).toLocaleString()%>" class="mini-textbox"  allowInput="false" required="true" style="width:99%;" title="制单时间"></td>
		<td class="td_left" >项目编号：</td>
		<td class="td_right">
			<input name="projectNo"  class="mini-textbox" allowInput="false" required="true"  emptyText="项目编号自动生成"  style="width:99%;" title="项目编号"></td>
		</tr>
		<tr>
			<td class="td_left" >项目名称：</td>
			<td class="td_right">
				<input name="projectName"   class="mini-textbox"  emptyText='请输入项目名称' required="true"  style="width:99%;" title="项目名称"></td>
			<td class="td_left" >项目类型：</td>
				<td class="td_right" >
			<input name="projectType" class="mini-combobox" emptyText="下拉框选择" allowInput="false" required="true" url="<%=path%>/param/findAllProjecttypeJson.action" valueField="name" textField="text"  style="width:99%;" title="项目类型"></td>
		
			<td class="td_left">预计开始时间：</td>
			<td  class="td_right">
				<input name="expectStartDate"  class="mini-datepicker" onvaluechanged='sumDay()'  allowInput='false' required="true"  emptyText="请选择开始时间"  style="width:99%;" title="预计开始时间"></td>
		</tr>
		<tr>
			<td class="td_left">预计结束时间：</td>
			<td class="td_right">
				<input name="expectEndDate"   class="mini-datepicker"  onvaluechanged='sumDay()' allowInput='false' required="true"  emptyText="请选择结束时间"  style="width:99%;" title="预计结束时间"></td>
			<td class="td_left">预计工期：</td>
			<td class="td_right">
				<input name="expectDay"  class="mini-textbox"  allowInput="false"  emptyText="自动计算工期" style="width:99%;" title="预计工期"></td>
			<td class="td_left" ></td>
			<td class="td_right" ></td>
		</tr>
		<tr>
			<td class="td_left" >工作内容简介：</td>
			<td class="td_right" colspan="5">
			<input name="content"  class="mini-textbox"  style="width:99%;" title="工作内容简介"></td>
		</tr>
	</table>
	</div>
	</div>
</div>
<!--此注释不允许删除读取字段用-->
<div class="col-md-7" name="FormMode" id="FormMode" style="width:1200px;margin:20px auto;float:none;">
    <div class="widget-container fluid-height col-md-7-k" style="height:auto;border-radius:4px;">
	<div class="mbox-header" >
		<span class="form-title" style="height:100%;line-height:45px;">
			<i class="o-host-application" style="background-position: -0px -20px;"></i>
			项目组织
		</span>
	</div>
	<div class="mbox-body"  style="height:100%;padding:10px;">
<table style="width:100%;margin:auto;margin-top:5px;" id="tab">
<tr>
	<td class="td_left"  >项目经理：</td>
	<td class="td_right" >
		<input name="projectDirector"  class="mini-treeselect" multiSelect="true" url="/HTOA/admin/findOrgTree.action" valueField="id" textField="text"   style="width:99%;" showClose="true" oncloseclick="onCloseClick"  title="姓名">
	</td>
	<td class="td_left" >项目助理：</td>
	<td class="td_right"  >
		<input name="designDirector"  class="mini-treeselect" multiSelect="true"  url="/HTOA/admin/findOrgTree.action" valueField="id" textField="text"   style="width:99%;" showClose="true" oncloseclick="onCloseClick"  title="姓名">
	</td>
	<td class="td_left" >计划负责人：</td>
	<td class="td_right" >
		<input name="purchaseDirector"  class="mini-treeselect" multiSelect="true"  url="/HTOA/admin/findOrgTree.action" valueField="id" textField="text"   style="width:99%;" showClose="true" oncloseclick="onCloseClick"  title="姓名">
	</td>
</tr>
<tr>
	<td class="td_left" >成本负责人：</td>
	<td class="td_right" >
		<input name="constructionDirector"  class="mini-treeselect" multiSelect="true"  url="/HTOA/admin/findOrgTree.action" valueField="id" textField="text"   style="width:99%;" showClose="true" oncloseclick="onCloseClick"  title="姓名">
	</td>
	<td class="td_left" >质量负责人：</td>
	<td class="td_right" >
		<input name="costDirector"  class="mini-treeselect" multiSelect="true"  url="/HTOA/admin/findOrgTree.action" valueField="id" textField="text"   style="width:99%;" showClose="true" oncloseclick="onCloseClick"  title="姓名">
	</td>
	<td class="td_left" >采购负责人：</td>
	<td class="td_right">
		<input name="marketDirector"  class="mini-treeselect" multiSelect="true"  url="/HTOA/admin/findOrgTree.action" valueField="id" textField="text"   style="width:99%;" showClose="true" oncloseclick="onCloseClick"  title="姓名">
	</td>
</tr>
<tr>
	<td class="td_left" >设计负责人：</td>
	<td class="td_right" >
		<input name="planDirector"  class="mini-treeselect" multiSelect="true"  url="/HTOA/admin/findOrgTree.action" valueField="id" textField="text"   style="width:99%;" showClose="true" oncloseclick="onCloseClick"  title="姓名">
	</td>
	<td class="td_left" ></td>
	<td class="td_right" >
		
	</td>
	<td class="td_left" ></td>
	<td class="td_right" >
	</td>
</tr>
</table>
<!--此注释不允许删除读取字段用-->
</div></div></div>
<div class="Noprint mini-toolbar"
			style="left:0;width:100%;top:0;height:35px;color:#fff;border-top-color:#ebeff6;background-color:rgba(255,255,255)!important;border-top-width:1px;border-top-style:solid;position:fixed;text-align:center">
			<table style="width:1000px;margin:auto;height:35px;">
				<tr>
					<!--此处放表单的操作按钮-->
					<td style="text-align:left" id="btnContL">
					<td style="text-align:right;padding-right:20px" id="btnContR"></td>
				</tr>
			</table>
		</div>
</div>
</div>
</form>
</body>
</html>


